package com.aistar.mapper;

import com.aistar.model.entity.Interview;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName: InterviewMapper
 * @author: LiuWenXiu
 * @date: 2021/9/30 22:22
 * @Description: TODO...
 */
public interface InterviewMapper {

    // 查看某职位的邀约面试消息
    @Select("select * from interview where recruitment_id = #{recruitmentId}")
    List<Interview> findByRecruitmentId(Integer recruitmentId);

    // 查看某简历对应的邀约面试消息
    @Select("select * from interview where resume_id = #{resumeId}")
    List<Interview> findByResumeId(Integer resumeId);

    // 创建邀约面试信息
    @Insert("insert into interview(delivery_id,resume_id,recruitment_id,interview_time,interview_address) values(#{deliveryId},#{resumeId},#{recruitmentId},#{interviewTime},#{interviewAddress})")
    int createInterview(Interview interview);

    // 根据id获取邀约面试信息
    @Select("select * from interview where id = #{id}")
    Interview findById(Integer id);

    // 根据邀约面试id删除邀约信息
    @Delete("delete from interview where id = #{id}")
    Integer deleteById(Integer id);

    // 根据邀约面试id更新邀约面试信息
    @Update("update interview set interview_time = #{interviewTime},interview_address = #{interviewAddress} where id = #{id}")
    Integer updateById(Interview interview);

}
